package com.udata.server.model;

import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import com.google.appengine.api.datastore.Key;
import com.udata.shared.model.StokeB;

@PersistenceCapable
public class Stoke {

	public Stoke() {
	}

	@PrimaryKey
	@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
	private Key id;
	@Persistent
	private String name;
	@Persistent
	private Double value;
	@Persistent
	private Double change;
	@Persistent
	private Long transaction;

	public Key getId() {
		return id;
	}

	public void setId(Key id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Double getValue() {
		return value;
	}

	public void setValue(Double value) {
		this.value = value;
	}

	public Double getChange() {
		return change;
	}

	public void setChange(Double change) {
		this.change = change;
	}

	public Long getTransaction() {
		return transaction;
	}

	public void setTransaction(Long transaction) {
		this.transaction = transaction;
	}

	public Stoke(StokeB stokeB) {
		this.id = stokeB.getId();
		this.name = stokeB.getName();
		this.value = stokeB.getValue();
		this.change = stokeB.getChange();
		this.transaction = stokeB.getTransaction();
	}

	public StokeB getBean() {
		StokeB stokeB = new StokeB();
		stokeB.setId(id);
		stokeB.setName(name);
		stokeB.setValue(value);
		stokeB.setChange(change);
		stokeB.setTransaction(transaction);
		return stokeB;
	}

}
